package org.example.threads;

import com.google.common.collect.Lists;

import java.util.List;

/**
 * 系统常量
 *
 * @author bingfang
 * @since 2021-08-04
 */
public class Constant {
    public static Integer SYNC = 0;

    public static final String QR_CODE = "";

    /**
     * 26字母
     */
    public static final List<String> COL_INDEX_LIST = Lists.newArrayList("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z");

    /**
     * redis缓存配置
     */
    public static final String CACHE_10_MIN_DEFAULT = "cache_10_min_default";
    public static final String CACHE_30_SECOND = "cache_30_second";

    /**
     * 缓存路径
     */
    public static String CACHE_DIR;

    /**
     * 系统默认编码
     */
    public static final String UTF_8 = "UTF-8";

    /**
     * 系统默认时间格式
     */
    public static final String DEFAULT_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";

    /**
     * 系统默认日期格式
     */
    public static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd";

    /**
     * 系统默认时间区域
     */
    public static final String DEFAULT_TIMEZONE = "GMT+8";

    /**
     * 默认contentType
     */
    public static final String APPLICATION_JSON = "application/json";

    /**
     * 线程池相关配置
     */
    public static Integer CORE_POOL_SIZE = 8;
    public static Integer MAXIMUM_POOL_SIZE = 20;
    public static Long KEEP_ALIVE_TIME_MILLIS = 300L;

    /**
     * 请求token
     */
    public final static String AUTHORIZATION = "cbjsAuthorization";

    /**
     * 存储桶
     */
    public static final String DEFAULT_BUCKET = "file-data";

    /**
     * 点
     */
    public static final String POINT = ".";

    /**
     * 需要显示的行
     */
    public static List<String> HIDE_ONAME_LIST = Lists.newArrayList();

    /**
     * 需要隐藏的列
     */
    public static List<String> HIDE_COL = Lists.newArrayList();

    /**
     * 正则表达式
     */
    public static class Regex {
        /**
         * 不为空时匹配手机号
         */
        public final static String MOBILE = "(^((13[0-9])|(14[579])|(15[0-3,5-9])|166|(17[135678])|(18[0-9])|(19[89]))\\d{8}$)|(^([5689])\\d{7}$)|";

        /**
         * 不为空时正则校验ip
         */
        public final static String IP = "(([1-9]|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])(\\.(\\d|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])){3})|";

        /**
         * 不为空时，URL校验
         */
        public final static String URL = "(^(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|])|";

        /**
         * 浮点数正则
         */
        public final static String NUM = "(^(-?\\d+)(\\.\\d+)?$)|";
    }
}
